(function() {
	angular
		.module('ydApp.classRoom', [])
		.config(function($stateProvider) {
			$stateProvider.state('classRoom-list', {
				url: '/classRoom-list',
				controller: "classRoomListCtrl",
				templateUrl: 'views/classRoom/classRoom-list.html'
			});
		})
		.controller("classRoomListCtrl", classRoomListCtrl);

	function classRoomListCtrl($scope, xhr, $state, $location, $cordovaInAppBrowser) {
		var vm = $scope.vm = {};

		$scope.downloadImg = function(img) {
			return config.api + "HealthInquiry" + img;
		}

		vm.condition = {
			pageIndex: 0,
			pageSize: 10000
		}

		xhr.get("HealthInquiry/com/lecture/findByCondition", vm.condition).then(function(result) {
			vm.data = result.data;
		})

		vm.toDetail = function(url) {
			$location.url(url);
		}

		var options = {
			location: 'no',
			clearcache: 'no',
			toolbar: 'yes'
		};

		$scope.open = function(link) {
			//http://115.28.128.133:8080/HealthInquiry/view/base/sendMsg_form.jsp
			$cordovaInAppBrowser.open(link, '_blank', options);
		}
	}
})();